<template>
  <div id="app" :class="{ 'light-theme': isLightTheme }">
    <AppNavbar v-if="!$route.meta.hideNavbar" @theme-change="handleThemeChange"/>
    <router-view />
    <FeatureHighlights v-if="$route.path === '/'" />
  </div>
</template>

<script setup>
import { ref } from 'vue';
import AppNavbar from './components/AppNavbar.vue';

const isLightTheme = ref(false);

const handleThemeChange = (isLight) => {
  isLightTheme.value = isLight;
};
</script>

<style>
/* 全局 CSS 变量定义（关键） */
:root {
  --bg-dark: #181717;
  --bg-light: #f5f0ff;
  --text-dark: #ffffff;
  --text-light: #333333;
  --border-gradient: linear-gradient(45deg, #e032ff, #f3daff,  #ffbdf4,#ff7ae4);
}

body {
  background-color: var(--bg-dark);
  color: var(--text-dark);
  transition: all 0.3s ease;
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--border-gradient);
  background-size: 400% 400%;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: gradientBorder 8s ease infinite;
}

body.light-theme::before {
  opacity: 1;
}

@keyframes gradientBorder {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* 默认应用黑夜模式 */
body {
  background-color: var(--bg-dark);
  color: var(--text-dark);
  transition: all 0.3s ease; /* 平滑过渡 */
}

/* 白天模式覆盖 */
body.light-theme {
  background-color: var(--bg-light);
  color: var(--text-light);
}

#app {
  width: 100%;
  min-height: 100vh;
}
</style>

